package edu.cdnu.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import edu.cdnu.pojo.HomeworkPojo;
import edu.cdnu.pojo.HomeworkStudentPojo;
import io.lettuce.core.dynamic.annotation.Param;

/**
 * 关于课程任务的操作的Dao层
 * @author ASUS AsingZ
 */
@Mapper
public interface HomeworkDao extends BaseMapper<HomeworkDao> {
	
	/**
	 * 通过课程id查询课程任务列表
	 * @param courseId
	 * @return
	 */
	public List<HomeworkPojo> selectHomeworkListByCourseId(int courseId);
	
	/**
	 * 新增一个课程任务
	 * @param homeworkPojo
	 */
	public void insertHomework(HomeworkPojo homeworkPojo);
	
	/**
	 * 修改课程任务
	 * @param homeworkPojo
	 */
	public void updateHomeWorkByHomeworkPojo(HomeworkPojo homeworkPojo);
	
	/**
	 * 删除一个课程任务
	 * @param homeworkId
	 */
	public void deleteHomeworkByHomeworkId(int homeworkId);
	
	/**
	 * 通过 任务id,学生id查询课程任务列表
	 * @param homeworkId
	 * @param studentId
	 * @return
	 */
	public List<HomeworkStudentPojo> selectHomeworkListByHomeworkIdAndStudentId(
			@Param("homeworkId") Integer homeworkId,@Param("studentId") Integer studentId);
	
	/**
	 * 插入一个作业信息
	 * @param homeworkStudentPojo
	 */
	public void insertHomeworkStudent(HomeworkStudentPojo homeworkStudentPojo);
	
	/**
	 * 修改作业信息
	 * @param homeworkStudentPojo
	 */
	public void updateHomeworkStudent(HomeworkStudentPojo homeworkStudentPojo);
	
	/**
	 * 根据课程任务的id来查询参与的列表
	 * 不包含学生，只有对应关系
	 * @param homeworkId
	 * @return
	 */
	public List<HomeworkStudentPojo> selectHomeworkStudentListByHomeworkId(Integer homeworkId);
	
	/**
	 * 根据课程任务的id来查询参与的列表
	 * 包含学生信息
	 * @param homeworkId
	 * @return
	 */
	public List<Map<String,Object>> selectHomeworkStudentInfoListByHomeworkId(Integer homeworkId);
	
}
